/*
 * @Author: 2112778581 2112778581@qq.com
 * @Date: 2023-10-16 10:13:29
 * @LastEditors: fengshan@0525 3183359488@qq.com
 * @LastEditTime: 2023-10-20 10:47:09
 * @FilePath: \pra\libs\db\src\models\news.model.ts
 * @Description: 统计进入页面的人数表
 */
import { ApiProperty } from '@nestjs/swagger';
import { modelOptions, prop } from '@typegoose/typegoose';
import { IsNotEmpty, Allow } from 'class-validator';

@modelOptions({
  // 自动为每个属性添加时间戳
  schemaOptions: {
    timestamps: true,
  },
})
export class Statistics {
  @ApiProperty({ description: 'ip' })
  @IsNotEmpty({ message: 'ip不能为空' })
  @prop()
  ip: string;

  @ApiProperty({ description: '区域' })
  @IsNotEmpty({ message: '区域不能为空' })
  @prop()
  region: string

  @ApiProperty({ description: 'hours 24进制的时间' })
  @IsNotEmpty({ message: '24进制的时间不能为空' })
  @prop()
  hours: string

  @ApiProperty({ description: '日期时间' })
  @IsNotEmpty({ message: '24进制的时间不能为空' })
  @prop()
  day: string

  @ApiProperty({ description: '月份时间' })
  @IsNotEmpty({ message: '月份不能为空' })
  @prop()
  month: string

  @ApiProperty({ description: '年份' })
  @IsNotEmpty({ message: '年份不能为空' })
  @prop()
  year: string

  @Allow()
  _id: string;

  @Allow()
  createdAt: string;

  @Allow()
  updatedAt: string;

  @Allow()
  __v: string;
}
